import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * @author : zzr
 * @description :
 * @date :
 */
public class TestForexam {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        while(in.hasNextLine()) {
            String s1 = in.nextLine();
            String s2 = in.nextLine();
            func(s1,s2);
        }
    }

    public static void func(String str1, String str2) {
        Set<Character> set1 = new HashSet<>();
        for(char ch : str2.toUpperCase().toCharArray()) {
            set1.add(ch);
        }

        Set<Character> set2 = new HashSet<>();
        for(char ch : str1.toUpperCase().toCharArray()) {
            if(!set1.contains(ch) && !set2.contains(ch)) {
                System.out.print(ch);
                set2.add(ch);
            }
        }
    }
}
